

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Scripting Capabilities &mdash; porymap  documentation</title>
  

  
  
    <link rel="shortcut icon" href="../_static/porymap-icon-2.ico"/>
  
  
  

  
  <script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script type="text/javascript" src="../_static/jquery.js"></script>
        <script type="text/javascript" src="../_static/underscore.js"></script>
        <script type="text/javascript" src="../_static/doctools.js"></script>
        <script type="text/javascript" src="../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="Project Files" href="project-files.html" />
    <link rel="prev" title="The Tileset Editor" href="tileset-editor.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: linear-gradient(180deg, #08ACD5 50%, #FF6262 0%);" >
          

          
            <a href="../index.html" class="icon icon-home"> porymap
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">User Manual</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="introduction.html">Introduction</a><ul>
<li class="toctree-l2"><a class="reference internal" href="introduction.html#about-porymap">About Porymap</a></li>
<li class="toctree-l2"><a class="reference internal" href="introduction.html#getting-started">Getting Started</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="navigation.html">Navigation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="navigation.html#map-list">Map List</a></li>
<li class="toctree-l2"><a class="reference internal" href="navigation.html#main-window">Main Window</a></li>
<li class="toctree-l2"><a class="reference internal" href="navigation.html#tileset-editor">Tileset Editor</a></li>
<li class="toctree-l2"><a class="reference internal" href="navigation.html#region-map-editor">Region Map Editor</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="editing-map-tiles.html">Editing Map Tiles</a><ul>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#visual-options">Visual Options</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#selecting-metatiles">Selecting Metatiles</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#pencil-tool">Pencil Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#pointer-tool">Pointer Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#bucket-fill-tool">Bucket Fill Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#map-shift-tool">Map Shift Tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#smart-paths">Smart Paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#straight-paths">Straight Paths</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#change-map-border">Change Map Border</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#change-map-tilesets">Change Map Tilesets</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#undo-redo">Undo &amp; Redo</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-tiles.html#prefabs">Prefabs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="editing-map-collisions.html">Editing Map Collisions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="editing-map-collisions.html#selecting-collision-types">Selecting Collision Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-collisions.html#painting-collisions">Painting Collisions</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-collisions.html#collision-types">Collision Types</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="editing-map-events.html">Editing Map Events</a><ul>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#adding-deleting-events">Adding &amp; Deleting Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#event-positions">Event Positions</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#object-events">Object Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#clone-object-events">Clone Object Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#warp-events">Warp Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#trigger-events">Trigger Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#weather-trigger-events">Weather Trigger Events</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#sign-event">Sign Event</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#hidden-item-event">Hidden Item Event</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#secret-base-event">Secret Base Event</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#heal-location-healspots">Heal Location / Healspots</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#open-map-scripts">Open Map Scripts</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#tool-buttons">Tool Buttons</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-events.html#ruler-tool">Ruler Tool</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="editing-map-header.html">Editing Map Headers</a></li>
<li class="toctree-l1"><a class="reference internal" href="editing-map-connections.html">Editing Map Connections</a><ul>
<li class="toctree-l2"><a class="reference internal" href="editing-map-connections.html#dive-emerge-warps">Dive &amp; Emerge Warps</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-connections.html#mirror-connections">Mirror Connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-map-connections.html#follow-connections">Follow Connections</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="editing-wild-encounters.html">Editing Wild Encounters</a><ul>
<li class="toctree-l2"><a class="reference internal" href="editing-wild-encounters.html#adding-new-encounter-groups">Adding New Encounter Groups</a></li>
<li class="toctree-l2"><a class="reference internal" href="editing-wild-encounters.html#configuring-the-wild-encounter-fields">Configuring the Wild Encounter Fields</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="creating-new-maps.html">Creating New Maps</a><ul>
<li class="toctree-l2"><a class="reference internal" href="creating-new-maps.html#new-map-options">New Map Options</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="region-map-editor.html">The Region Map Editor</a><ul>
<li class="toctree-l2"><a class="reference internal" href="region-map-editor.html#background-image-tab">Background Image Tab</a></li>
<li class="toctree-l2"><a class="reference internal" href="region-map-editor.html#map-layout-tab">Map Layout Tab</a></li>
<li class="toctree-l2"><a class="reference internal" href="region-map-editor.html#map-entries-tab">Map Entries Tab</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tileset-editor.html">The Tileset Editor</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tileset-editor.html#metatile-properties">Metatile Properties</a><ul>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#layer-type">Layer Type</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#metatile-behavior">Metatile Behavior</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#encounter-type">Encounter Type</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#terrain-type">Terrain Type</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#metatile-label">Metatile Label</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="tileset-editor.html#tools-menu">Tools Menu</a><ul>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#import-tiles-image">Import Tiles Image…</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#import-metatiles-from-advance-map-1-92">Import Metatiles from Advance Map 1.92…</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#change-number-of-metatiles">Change Number of Metatiles</a></li>
<li class="toctree-l3"><a class="reference internal" href="tileset-editor.html#other-tools">Other Tools</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="tileset-editor.html#palette-editor">Palette Editor</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Scripting Capabilities</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#custom-scripts-editor">Custom Scripts Editor</a></li>
<li class="toctree-l2"><a class="reference internal" href="#writing-a-custom-script">Writing a Custom Script</a></li>
<li class="toctree-l2"><a class="reference internal" href="#registering-script-actions">Registering Script Actions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#scripting-api">Scripting API</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#callbacks">Callbacks</a></li>
<li class="toctree-l3"><a class="reference internal" href="#functions">Functions</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#map-editing-functions">Map Editing Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#map-header-editing-functions">Map Header Editing Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#tileset-functions">Tileset Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#overlay-functions">Overlay Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#settings-functions">Settings Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#utility-functions">Utility Functions</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#constants">Constants</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="project-files.html">Project Files</a></li>
<li class="toctree-l1"><a class="reference internal" href="shortcuts.html">Shortcuts</a><ul>
<li class="toctree-l2"><a class="reference internal" href="shortcuts.html#main-window">Main Window</a></li>
<li class="toctree-l2"><a class="reference internal" href="shortcuts.html#tileset-editor">Tileset Editor</a></li>
<li class="toctree-l2"><a class="reference internal" href="shortcuts.html#region-map-editor">Region Map Editor</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="settings-and-options.html">Porymap Settings</a><ul>
<li class="toctree-l2"><a class="reference internal" href="settings-and-options.html#global-settings">Global settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="settings-and-options.html#project-settings">Project settings</a><ul>
<li class="toctree-l3"><a class="reference internal" href="settings-and-options.html#general">General</a></li>
<li class="toctree-l3"><a class="reference internal" href="settings-and-options.html#maps">Maps</a></li>
<li class="toctree-l3"><a class="reference internal" href="settings-and-options.html#tilesets">Tilesets</a></li>
<li class="toctree-l3"><a class="reference internal" href="settings-and-options.html#events">Events</a></li>
<li class="toctree-l3"><a class="reference internal" href="settings-and-options.html#files-identifiers">Files &amp; Identifiers</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<p class="caption"><span class="caption-text">Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../reference/changelog.html">Changelog</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#unreleased">Unreleased</a></li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id1">5.4.1 - 2024-03-21</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#fixed">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id2">5.4.0 - 2024-02-13</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#added">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#changed">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id3">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id4">5.3.0 - 2024-01-15</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id5">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id6">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id7">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id8">5.2.0 - 2024-01-02</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id9">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id10">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id11">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id12">5.1.1 - 2023-02-20</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id13">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id14">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id15">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id16">5.1.0 - 2023-01-22</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id17">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id18">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id19">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id20">5.0.0 - 2022-10-30</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#breaking-changes">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id21">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id22">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id23">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id24">4.5.0 - 2021-12-26</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id25">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id26">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id27">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id28">4.4.0 - 2020-12-20</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id29">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id30">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id31">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id32">4.3.1 - 2020-07-17</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id33">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id34">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id35">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id36">4.3.0 - 2020-06-27</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id37">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id38">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id39">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id40">4.2.0 - 2020-06-06</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id41">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id42">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id43">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id44">4.1.0 - 2020-05-18</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id45">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id46">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id47">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id48">4.0.0 - 2020-04-28</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id49">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id50">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id51">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id52">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id53">3.0.1 - 2020-03-04</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id54">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id55">3.0.0 - 2020-03-04</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id56">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id57">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id58">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id59">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id60">2.0.0 - 2019-10-16</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id61">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id62">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id63">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id64">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id65">1.2.2 - 2019-05-16</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id66">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id67">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id68">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id69">1.2.1 - 2019-02-16</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id70">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id71">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id72">1.2.0 - 2019-02-04</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id73">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id74">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id75">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id76">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id77">1.1.0 - 2018-12-27</a><ul>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id78">Breaking Changes</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id79">Added</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id80">Changed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../reference/changelog.html#id81">Fixed</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../reference/changelog.html#id82">1.0.0 - 2018-10-26</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../reference/related-projects.html">Related Projects</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">porymap</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html">Docs</a> &raquo;</li>
        
      <li>Scripting Capabilities</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            
              <a href="https://github.com/huderlem/porymap/blob/master/docsrc/manual/scripting-capabilities.rst" class="fa fa-github"> Edit on GitHub</a>
            
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="scripting-capabilities">
<h1>Scripting Capabilities<a class="headerlink" href="#scripting-capabilities" title="Permalink to this headline">¶</a></h1>
<p>Porymap is extensible via scripting capabilities. This allows the user to write custom JavaScript (technically, ECMAScript) files to support enhanced workflows, without having to fork Porymap itself. While the possibilities are endless, some useful examples of scripting might be:</p>
<ul class="simple">
<li>Toggle Day/Night Palettes</li>
<li>Custom Map Painting Brushes</li>
<li>Detect Tile Errors</li>
<li>Show Diagonistic Information</li>
<li>Procedurally Generated Maps</li>
<li>Randomize Grass Patterns</li>
</ul>
<div class="section" id="custom-scripts-editor">
<h2>Custom Scripts Editor<a class="headerlink" href="#custom-scripts-editor" title="Permalink to this headline">¶</a></h2>
<p>Your custom scripts can be managed with the Custom Scripts Editor accessible under <code class="docutils literal notranslate"><span class="pre">Options</span> <span class="pre">-&gt;</span> <span class="pre">Custom</span> <span class="pre">Scripts...</span></code>.</p>
<div class="figure align-center" id="id2">
<a class="reference internal image-reference" href="../_images/custom-scripts-editor.png"><img alt="Custom Scripts Editor" src="../_images/custom-scripts-editor.png" style="width: 60%;" /></a>
<p class="caption"><span class="caption-text">Custom Scripts Editor</span></p>
</div>
<dl class="docutils">
<dt>At the top there are three basic buttons for managing your scripts:</dt>
<dd><ul class="first last simple">
<li><a class="reference internal" href="../_images/button-create.png"><img alt="button-create" src="../_images/button-create.png" style="height: 24px;" /></a> Opens a prompt to create a new script file, which will be populated with a basic template.</li>
<li><a class="reference internal" href="../_images/button-load.png"><img alt="button-load" src="../_images/button-load.png" style="height: 24px;" /></a> Lets you add an existing script file to Porymap that you’ve already created or downloaded from elsewhere.</li>
<li><a class="reference internal" href="../_images/button-refresh.png"><img alt="button-refresh" src="../_images/button-refresh.png" style="height: 24px;" /></a> Any edits made to your scripts while Porymap is already open will not be reflected until you select this button.</li>
</ul>
</dd>
</dl>
<p>Below these buttons is a list of all the custom scripts you have loaded for your project. Each entry will have a text box showing the path of the script file. This path can be freely updated, or you can choose a new path with the <a class="reference internal" href="../_images/folder.png"><img alt="button-folder" src="../_images/folder.png" style="width: 24px; height: 24px;" /></a> button next to it. The <a class="reference internal" href="../_images/file_edit.png"><img alt="button-edit" src="../_images/file_edit.png" style="width: 24px; height: 24px;" /></a> button will open the script file in your default text editor, and the <a class="reference internal" href="../_images/delete.png"><img alt="button-remove" src="../_images/delete.png" style="width: 24px; height: 24px;" /></a> button will remove it from the list. The check box to the left of the filepath indicates whether your script should be running. If you’d like to temporarily disable a script you can uncheck this box.</p>
</div>
<div class="section" id="writing-a-custom-script">
<h2>Writing a Custom Script<a class="headerlink" href="#writing-a-custom-script" title="Permalink to this headline">¶</a></h2>
<p>Let’s write a custom script that will randomize grass patterns when the user is editing the map. This is useful, since it’s cumbersome to manually add randomness to grass patches. With the custom script, it will happen automatically. Whenever the user paints a grass tile onto the map, the script will overwrite the tile with a random grass tile instead.</p>
<p>First, open the <code class="docutils literal notranslate"><span class="pre">Options</span> <span class="pre">-&gt;</span> <span class="pre">Custom</span> <span class="pre">Scripts...</span></code> window and select the <a class="reference internal" href="../_images/button-create.png"><img alt="button-create" src="../_images/button-create.png" style="height: 24px;" /></a> button. This will open a file save prompt; let’s name our new script file <code class="docutils literal notranslate"><span class="pre">my_script.js</span></code> and save it. We’ve successfully added a new script! We can now see it listed in the editor.</p>
<div class="figure align-center">
<a class="reference internal image-reference" href="../_images/new-script.png"><img alt="Our New Script" src="../_images/new-script.png" style="width: 60%;" /></a>
</div>
<p>At the moment our script doesn’t do anything. Let’s select the <a class="reference internal" href="../_images/file_edit.png"><img alt="button-edit" src="../_images/file_edit.png" style="width: 24px; height: 24px;" /></a> button to open it and write the actual code that will power the grass-randomizer. Once the script file is open you will notice that there are several empty functions already inside. These are special “callback” functions that will be called automatically for certain events that occur while Porymap is running. We’re interested in the <code class="docutils literal notranslate"><span class="pre">onBlockChanged()</span></code> callback, since we want our script to take action whenever a user paints a block on the map.</p>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="c1">// Porymap callback when a block is painted.</span>
<span class="kr">export</span> <span class="kd">function</span> <span class="nx">onBlockChanged</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">prevBlock</span><span class="p">,</span> <span class="nx">newBlock</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Grass-randomizing logic goes here.</span>
<span class="p">}</span>
</pre></div>
</div>
<p>We can leave the rest of the callback functions in here alone, or we can delete them because we’re not using them. Every callback function does not need to be defined in your script. <strong>Note</strong>: For Porymap to be able to execute these callback functions they need to have the <code class="docutils literal notranslate"><span class="pre">export</span></code> keyword. The rest of the functions in your script do not need this keyword.</p>
<p>In addition to the callbacks, Porymap also supports a scripting API so that the script can interact with Porymap in interesting ways. For example, a script can change a block or add overlay text on the map. Since we want to paint random grass tiles, we’ll be using the <code class="docutils literal notranslate"><span class="pre">map.setMetatileId()</span></code> function. Let’s fill in the rest of the grass-randomizing code.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><strong>For pokeemerald/pokeruby users</strong>: We only have 1 regular grass metatile, but if you want to try this script you could replace <code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">grassTiles</span> <span class="pre">=</span> <span class="pre">[0x8,</span> <span class="pre">0x9,</span> <span class="pre">0x10,</span> <span class="pre">0x11];</span></code> in the code below with <code class="docutils literal notranslate"><span class="pre">const</span> <span class="pre">grassTiles</span> <span class="pre">=</span> <span class="pre">[0x1,</span> <span class="pre">0x4,</span> <span class="pre">0xD];</span></code> to randomize using tall grass and flowers instead!</p>
</div>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="kd">function</span> <span class="nx">randInt</span><span class="p">(</span><span class="nx">min</span><span class="p">,</span> <span class="nx">max</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">min</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">ceil</span><span class="p">(</span><span class="nx">min</span><span class="p">);</span>
    <span class="nx">max</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">max</span><span class="p">);</span>
    <span class="k">return</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="p">(</span><span class="nx">max</span> <span class="o">-</span> <span class="nx">min</span><span class="p">))</span> <span class="o">+</span> <span class="nx">min</span><span class="p">;</span>
<span class="p">}</span>

<span class="c1">// These are the grass metatiles in pokefirered.</span>
<span class="kr">const</span> <span class="nx">grassTiles</span> <span class="o">=</span> <span class="p">[</span><span class="mh">0x8</span><span class="p">,</span> <span class="mh">0x9</span><span class="p">,</span> <span class="mh">0x10</span><span class="p">,</span> <span class="mh">0x11</span><span class="p">];</span>

<span class="c1">// Porymap callback when a block is painted.</span>
<span class="kr">export</span> <span class="kd">function</span> <span class="nx">onBlockChanged</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">prevBlock</span><span class="p">,</span> <span class="nx">newBlock</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// Check if the user is painting a grass tile.</span>
    <span class="k">if</span> <span class="p">(</span><span class="nx">grassTiles</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">newBlock</span><span class="p">.</span><span class="nx">metatileId</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
        <span class="c1">// Choose a random grass tile and paint it on the map.</span>
        <span class="kr">const</span> <span class="nx">i</span> <span class="o">=</span> <span class="nx">randInt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nx">grassTiles</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span>
        <span class="nx">map</span><span class="p">.</span><span class="nx">setMetatileId</span><span class="p">(</span><span class="nx">x</span><span class="p">,</span> <span class="nx">y</span><span class="p">,</span> <span class="nx">grassTiles</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Let’s apply our changes by selecting the <a class="reference internal" href="../_images/button-refresh.png"><img alt="button-refresh" src="../_images/button-refresh.png" style="height: 24px;" /></a> button. Because we’ve added a new script we’ll be met with this confirmation prompt. Accept this prompt by selecting <code class="docutils literal notranslate"><span class="pre">YES</span></code>.</p>
<div class="figure align-center">
<a class="reference internal image-reference" href="../_images/refresh-prompt.png"><img alt="Refresh Scripts Prompt" src="../_images/refresh-prompt.png" style="width: 60%;" /></a>
</div>
<p>Now let’s test our script! If we try to paint grass on the map, we should see our script inserting a nice randomized grass pattern.</p>
<div class="figure" id="id3">
<img alt="Grass-Randomizing Script" src="../_images/porymap-scripting-grass.gif" />
<p class="caption"><span class="caption-text">Grass-Randomizing Script</span></p>
</div>
</div>
<div class="section" id="registering-script-actions">
<h2>Registering Script Actions<a class="headerlink" href="#registering-script-actions" title="Permalink to this headline">¶</a></h2>
<p>The grass-randomizer script above happens implicitly when the user paints on the map. However, other times we probably want to call the custom script on demand. One of the API functions Porymap provides is the ability to trigger scripting functions from the <code class="docutils literal notranslate"><span class="pre">Tools</span></code> menu, or a keyboard shortcut. To do this, we will usually want to register the action when the project loads. Here is an example script where some custom actions are registered.</p>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="kr">export</span> <span class="kd">function</span> <span class="nx">applyNightTint</span><span class="p">()</span> <span class="p">{</span>
    <span class="c1">// Apply night palette tinting...</span>
<span class="p">}</span>

<span class="c1">// Porymap callback when project is opened.</span>
<span class="kr">export</span> <span class="kd">function</span> <span class="nx">onProjectOpened</span><span class="p">(</span><span class="nx">projectPath</span><span class="p">)</span> <span class="p">{</span>
   <span class="nx">utility</span><span class="p">.</span><span class="nx">registerAction</span><span class="p">(</span><span class="s2">&quot;applyNightTint&quot;</span><span class="p">,</span> <span class="s2">&quot;View Night Tint&quot;</span><span class="p">,</span> <span class="s2">&quot;T&quot;</span><span class="p">)</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Then, to trigger the <code class="docutils literal notranslate"><span class="pre">applyNightTint()</span></code> function, we could either click <code class="docutils literal notranslate"><span class="pre">Tools</span> <span class="pre">-&gt;</span> <span class="pre">View</span> <span class="pre">Night</span> <span class="pre">Tint</span></code> or use the <code class="docutils literal notranslate"><span class="pre">T</span></code> keyboard shortcut. <strong>Note</strong>: Like callbacks, functions registered using <code class="docutils literal notranslate"><span class="pre">utility.registerAction()</span></code> also need the <code class="docutils literal notranslate"><span class="pre">export</span></code> keyword for Porymap to call them.</p>
<p>Now that we have an overview of how to utilize Porymap’s scripting capabilities, the entire scripting API is documented below.</p>
</div>
<div class="section" id="scripting-api">
<h2>Scripting API<a class="headerlink" href="#scripting-api" title="Permalink to this headline">¶</a></h2>
<div class="section" id="callbacks">
<h3>Callbacks<a class="headerlink" href="#callbacks" title="Permalink to this headline">¶</a></h3>
<dl class="function">
<dt id="onProjectOpened">
<code class="descname">onProjectOpened</code><span class="sig-paren">(</span><em>projectPath</em><span class="sig-paren">)</span><a class="headerlink" href="#onProjectOpened" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when Porymap successfully opens a project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>projectPath</strong> (<em>string</em>) – the directory path of the opened project</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onProjectClosed">
<code class="descname">onProjectClosed</code><span class="sig-paren">(</span><em>projectPath</em><span class="sig-paren">)</span><a class="headerlink" href="#onProjectClosed" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when Porymap closes a project. For example, this is called when opening a different project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>projectPath</strong> (<em>string</em>) – the directory path of the closed project</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onMapOpened">
<code class="descname">onMapOpened</code><span class="sig-paren">(</span><em>mapName</em><span class="sig-paren">)</span><a class="headerlink" href="#onMapOpened" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a map is opened.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>mapName</strong> (<em>string</em>) – the name of the opened map</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBlockChanged">
<code class="descname">onBlockChanged</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>prevBlock</em>, <em>newBlock</em><span class="sig-paren">)</span><a class="headerlink" href="#onBlockChanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a block is changed on the map. For example, this is called when a user paints a new tile or changes the collision property of a block.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>prevBlock</strong> (<em>object</em>) – the block’s state before it was modified. The object’s shape is <code class="docutils literal notranslate"><span class="pre">{metatileId,</span> <span class="pre">collision,</span> <span class="pre">elevation,</span> <span class="pre">rawValue}</span></code></li>
<li><strong>newBlock</strong> (<em>object</em>) – the block’s new state after it was modified. The object’s shape is <code class="docutils literal notranslate"><span class="pre">{metatileId,</span> <span class="pre">collision,</span> <span class="pre">elevation,</span> <span class="pre">rawValue}</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBorderMetatileChanged">
<code class="descname">onBorderMetatileChanged</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>prevMetatileId</em>, <em>newMetatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#onBorderMetatileChanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when a border metatile is changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>prevMetatileId</strong> (<em>number</em>) – the metatile id of the border block before it was modified</li>
<li><strong>newMetatileId</strong> (<em>number</em>) – the metatile id of the border block after it was modified</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBlockHoverChanged">
<code class="descname">onBlockHoverChanged</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#onBlockHoverChanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the mouse enters a new map block.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBlockHoverCleared">
<code class="descname">onBlockHoverCleared</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#onBlockHoverCleared" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the mouse exits the map.</p>
</dd></dl>

<dl class="function">
<dt id="onMapResized">
<code class="descname">onMapResized</code><span class="sig-paren">(</span><em>oldWidth</em>, <em>oldHeight</em>, <em>newWidth</em>, <em>newHeight</em><span class="sig-paren">)</span><a class="headerlink" href="#onMapResized" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the dimensions of the map are changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>oldWidth</strong> (<em>number</em>) – the width of the map before the change</li>
<li><strong>oldHeight</strong> (<em>number</em>) – the height of the map before the change</li>
<li><strong>newWidth</strong> (<em>number</em>) – the width of the map after the change</li>
<li><strong>newHeight</strong> (<em>number</em>) – the height of the map after the change</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBorderResized">
<code class="descname">onBorderResized</code><span class="sig-paren">(</span><em>oldWidth</em>, <em>oldHeight</em>, <em>newWidth</em>, <em>newHeight</em><span class="sig-paren">)</span><a class="headerlink" href="#onBorderResized" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the dimensions of the border are changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>oldWidth</strong> (<em>number</em>) – the width of the border before the change</li>
<li><strong>oldHeight</strong> (<em>number</em>) – the height of the border before the change</li>
<li><strong>newWidth</strong> (<em>number</em>) – the width of the border after the change</li>
<li><strong>newHeight</strong> (<em>number</em>) – the height of the border after the change</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onMapShifted">
<code class="descname">onMapShifted</code><span class="sig-paren">(</span><em>xDelta</em>, <em>yDelta</em><span class="sig-paren">)</span><a class="headerlink" href="#onMapShifted" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the map is updated by use of the Map Shift tool.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>xDelta</strong> (<em>number</em>) – the horizontal change from the shift</li>
<li><strong>yDelta</strong> (<em>number</em>) – the vertical change from the shift</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onTilesetUpdated">
<code class="descname">onTilesetUpdated</code><span class="sig-paren">(</span><em>tilesetName</em><span class="sig-paren">)</span><a class="headerlink" href="#onTilesetUpdated" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the currently loaded tileset is changed by switching to a new one or by saving changes to it in the Tileset Editor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>tilesetName</strong> (<em>string</em>) – the name of the updated tileset</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onMainTabChanged">
<code class="descname">onMainTabChanged</code><span class="sig-paren">(</span><em>oldTab</em>, <em>newTab</em><span class="sig-paren">)</span><a class="headerlink" href="#onMainTabChanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the selected tab in the main tab bar is changed. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Map, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Events, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Header, <code class="docutils literal notranslate"><span class="pre">3</span></code>: Connections, <code class="docutils literal notranslate"><span class="pre">4</span></code>: Wild Pokemon).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>oldTab</strong> (<em>number</em>) – the index of the previously selected tab</li>
<li><strong>newTab</strong> (<em>number</em>) – the index of the newly selected tab</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onMapViewTabChanged">
<code class="descname">onMapViewTabChanged</code><span class="sig-paren">(</span><em>oldTab</em>, <em>newTab</em><span class="sig-paren">)</span><a class="headerlink" href="#onMapViewTabChanged" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the selected tab in the map view tab bar is changed. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Metatiles, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Collision, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Prefabs).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>oldTab</strong> (<em>number</em>) – the index of the previously selected tab</li>
<li><strong>newTab</strong> (<em>number</em>) – the index of the newly selected tab</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="onBorderVisibilityToggled">
<code class="descname">onBorderVisibilityToggled</code><span class="sig-paren">(</span><em>visible</em><span class="sig-paren">)</span><a class="headerlink" href="#onBorderVisibilityToggled" title="Permalink to this definition">¶</a></dt>
<dd><p>Called when the visibility of the border and connecting maps is toggled on or off.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>visible</strong> (<em>boolean</em>) – whether the border is now visible</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="functions">
<h3>Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h3>
<div class="section" id="map-editing-functions">
<h4>Map Editing Functions<a class="headerlink" href="#map-editing-functions" title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to editing the map’s blocks or retrieving information about them.</p>
<p>All map editing functions are callable via the global <code class="docutils literal notranslate"><span class="pre">map</span></code> object.</p>
<dl class="function">
<dt id="map.getBlock">
<code class="descclassname">map.</code><code class="descname">getBlock</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getBlock" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the block object</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{metatileId,</span> <span class="pre">collision,</span> <span class="pre">elevation,</span> <span class="pre">rawValue}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBlock">
<code class="descclassname">map.</code><code class="descname">setBlock</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>collision</em>, <em>elevation</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBlock" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>metatileId</strong> (<em>number</em>) – the metatile id of the block</li>
<li><strong>collision</strong> (<em>number</em>) – the collision of the block (<code class="docutils literal notranslate"><span class="pre">0</span></code> = passable, <code class="docutils literal notranslate"><span class="pre">1-3</span></code> = impassable)</li>
<li><strong>elevation</strong> (<em>number</em>) – the elevation of the block</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">map.</code><code class="descname">setBlock</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>rawValue</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span></dt>
<dd><p>Sets a block in the currently-opened map. This is an overloaded function that takes the raw value of a block instead of each of the block’s properties individually.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>rawValue</strong> (<em>number</em>) – the 16 bit value of the block. Bits <code class="docutils literal notranslate"><span class="pre">0-9</span></code> will be the metatile id, bits <code class="docutils literal notranslate"><span class="pre">10-11</span></code> will be the collision, and bits <code class="docutils literal notranslate"><span class="pre">12-15</span></code> will be the elevation.</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileId">
<code class="descclassname">map.</code><code class="descname">getMetatileId</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileId" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the metatile id of a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the metatile id of the block</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileId">
<code class="descclassname">map.</code><code class="descname">setMetatileId</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileId" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the metatile id of a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>metatileId</strong> (<em>number</em>) – the metatile id of the block</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getBorderMetatileId">
<code class="descclassname">map.</code><code class="descname">getBorderMetatileId</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getBorderMetatileId" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the metatile id of a block in the border of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the metatile id of the block</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBorderMetatileId">
<code class="descclassname">map.</code><code class="descname">setBorderMetatileId</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBorderMetatileId" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the metatile id of a block in the border of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>metatileId</strong> (<em>number</em>) – the metatile id of the block</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getCollision">
<code class="descclassname">map.</code><code class="descname">getCollision</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getCollision" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the collision of a block in the currently-opened map. (<code class="docutils literal notranslate"><span class="pre">0</span></code> = passable, <code class="docutils literal notranslate"><span class="pre">1-3</span></code> = impassable)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the collision of the block</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setCollision">
<code class="descclassname">map.</code><code class="descname">setCollision</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>collision</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setCollision" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the collision of a block in the currently-opened map. (<code class="docutils literal notranslate"><span class="pre">0</span></code> = passable, <code class="docutils literal notranslate"><span class="pre">1-3</span></code> = impassable)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>collision</strong> (<em>number</em>) – the collision of the block</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getElevation">
<code class="descclassname">map.</code><code class="descname">getElevation</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getElevation" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the elevation of a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the elevation of the block</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setElevation">
<code class="descclassname">map.</code><code class="descname">setElevation</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>elevation</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setElevation" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the elevation of a block in the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – x coordinate of the block</li>
<li><strong>y</strong> (<em>number</em>) – y coordinate of the block</li>
<li><strong>elevation</strong> (<em>number</em>) – the elevation of the block</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBlocksFromSelection">
<code class="descclassname">map.</code><code class="descname">setBlocksFromSelection</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBlocksFromSelection" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets blocks on the map using the user’s current metatile selection.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – initial x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – initial y coordinate</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.bucketFill">
<code class="descclassname">map.</code><code class="descname">bucketFill</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.bucketFill" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a bucket fill of a metatile id, starting at the given coordinates.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – initial x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – initial y coordinate</li>
<li><strong>metatileId</strong> (<em>number</em>) – metatile id to fill</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.bucketFillFromSelection">
<code class="descclassname">map.</code><code class="descname">bucketFillFromSelection</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.bucketFillFromSelection" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a bucket fill using the user’s current metatile selection, starting at the given coordinates.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – initial x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – initial y coordinate</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.magicFill">
<code class="descclassname">map.</code><code class="descname">magicFill</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.magicFill" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a magic fill of a metatile id, starting at the given coordinates.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – initial x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – initial y coordinate</li>
<li><strong>metatileId</strong> (<em>number</em>) – metatile id to magic fill</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.magicFillFromSelection">
<code class="descclassname">map.</code><code class="descname">magicFillFromSelection</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.magicFillFromSelection" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a magic fill using the user’s current metatile selection, starting at the given coordinates.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – initial x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – initial y coordinate</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.shift">
<code class="descclassname">map.</code><code class="descname">shift</code><span class="sig-paren">(</span><em>xDelta</em>, <em>yDelta</em>, <em>forceRedraw = true</em>, <em>commitChanges = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.shift" title="Permalink to this definition">¶</a></dt>
<dd><p>Performs a shift on the map’s blocks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>xDelta</strong> (<em>number</em>) – number of blocks to shift horizontally</li>
<li><strong>yDelta</strong> (<em>number</em>) – number of blocks to shift vertically</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
<li><strong>commitChanges</strong> (<em>boolean</em>) – Commit the changes to the map’s edit/undo history. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. When making many related map edits, it can be useful to set this to <code class="docutils literal notranslate"><span class="pre">false</span></code>, and then commit all of them together with <code class="docutils literal notranslate"><span class="pre">map.commit()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getDimensions">
<code class="descclassname">map.</code><code class="descname">getDimensions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getDimensions" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the dimensions of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the dimensions of the map</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">object (<code class="docutils literal notranslate"><span class="pre">{width,</span> <span class="pre">height}</span></code>)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getWidth">
<code class="descclassname">map.</code><code class="descname">getWidth</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the width of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the width of the map</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getHeight">
<code class="descclassname">map.</code><code class="descname">getHeight</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the height of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the height of the map</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getBorderDimensions">
<code class="descclassname">map.</code><code class="descname">getBorderDimensions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getBorderDimensions" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the dimensions of the border of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the dimensions of the border</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">object (<code class="docutils literal notranslate"><span class="pre">{width,</span> <span class="pre">height}</span></code>)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getBorderWidth">
<code class="descclassname">map.</code><code class="descname">getBorderWidth</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getBorderWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the width of the border of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the width of the border</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getBorderHeight">
<code class="descclassname">map.</code><code class="descname">getBorderHeight</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getBorderHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the height of the border of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the height of the border</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setDimensions">
<code class="descclassname">map.</code><code class="descname">setDimensions</code><span class="sig-paren">(</span><em>width</em>, <em>height</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setDimensions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the dimensions of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>width</strong> (<em>number</em>) – width in blocks</li>
<li><strong>height</strong> (<em>number</em>) – height in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setWidth">
<code class="descclassname">map.</code><code class="descname">setWidth</code><span class="sig-paren">(</span><em>width</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the width of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>width</strong> (<em>number</em>) – width in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setHeight">
<code class="descclassname">map.</code><code class="descname">setHeight</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.setHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the height of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>height</strong> (<em>number</em>) – height in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBorderDimensions">
<code class="descclassname">map.</code><code class="descname">setBorderDimensions</code><span class="sig-paren">(</span><em>width</em>, <em>height</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBorderDimensions" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the dimensions of the border of the currently-opened map. If the config setting <code class="docutils literal notranslate"><span class="pre">use_custom_border_size</span></code> is set to <code class="docutils literal notranslate"><span class="pre">0</span></code> then this does nothing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>width</strong> (<em>number</em>) – width in blocks</li>
<li><strong>height</strong> (<em>number</em>) – height in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBorderWidth">
<code class="descclassname">map.</code><code class="descname">setBorderWidth</code><span class="sig-paren">(</span><em>width</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBorderWidth" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the width of the border of the currently-opened map. If the config setting <code class="docutils literal notranslate"><span class="pre">use_custom_border_size</span></code> is set to <code class="docutils literal notranslate"><span class="pre">0</span></code> then this does nothing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>width</strong> (<em>number</em>) – width in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBorderHeight">
<code class="descclassname">map.</code><code class="descname">setBorderHeight</code><span class="sig-paren">(</span><em>height</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBorderHeight" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the height of the border of the currently-opened map. If the config setting <code class="docutils literal notranslate"><span class="pre">use_custom_border_size</span></code> is set to <code class="docutils literal notranslate"><span class="pre">0</span></code> then this does nothing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>height</strong> (<em>number</em>) – height in blocks</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.redraw">
<code class="descclassname">map.</code><code class="descname">redraw</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.redraw" title="Permalink to this definition">¶</a></dt>
<dd><p>Redraws the entire map area. Useful when delaying map redraws using <code class="docutils literal notranslate"><span class="pre">forceRedraw</span> <span class="pre">=</span> <span class="pre">false</span></code> in certain map editing functions.</p>
</dd></dl>

<dl class="function">
<dt id="map.commit">
<code class="descclassname">map.</code><code class="descname">commit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Commits any uncommitted changes to the map’s edit/undo history. Useful when delaying commits using <code class="docutils literal notranslate"><span class="pre">commitChanges</span> <span class="pre">=</span> <span class="pre">false</span></code> in certain map editing functions.</p>
</dd></dl>

</div>
<div class="section" id="map-header-editing-functions">
<h4>Map Header Editing Functions<a class="headerlink" href="#map-header-editing-functions" title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to reading/writing the map’s header properties.</p>
<p>All map header functions are callable via the global <code class="docutils literal notranslate"><span class="pre">map</span></code> object.</p>
<dl class="function">
<dt id="map.getSong">
<code class="descclassname">map.</code><code class="descname">getSong</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getSong" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the background song for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the name of the song</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSong">
<code class="descclassname">map.</code><code class="descname">setSong</code><span class="sig-paren">(</span><em>song</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSong" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the name of the background song for the currently-opened map. The song name must be one of the names in the “Song” dropdown menu on the Header tab.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>song</strong> (<em>string</em>) – the name of the song</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getLocation">
<code class="descclassname">map.</code><code class="descname">getLocation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getLocation" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the region map location for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the name of the location</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setLocation">
<code class="descclassname">map.</code><code class="descname">setLocation</code><span class="sig-paren">(</span><em>location</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setLocation" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the name of the region map location for the currently-opened map. The location name must be one of the names in the “Location” dropdown menu on the Header tab.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>location</strong> (<em>string</em>) – the name of the location</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getRequiresFlash">
<code class="descclassname">map.</code><code class="descname">getRequiresFlash</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getRequiresFlash" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether flash would be required in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">whether flash is required</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setRequiresFlash">
<code class="descclassname">map.</code><code class="descname">setRequiresFlash</code><span class="sig-paren">(</span><em>require</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setRequiresFlash" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets whether flash would be required in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>require</strong> (<em>boolean</em>) – whether flash should be required</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getWeather">
<code class="descclassname">map.</code><code class="descname">getWeather</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getWeather" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the weather for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the name of the weather</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setWeather">
<code class="descclassname">map.</code><code class="descname">setWeather</code><span class="sig-paren">(</span><em>weather</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setWeather" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the name of the weather for the currently-opened map. The weather name must be one of the names in the “Weather” dropdown menu on the Header tab.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>weather</strong> (<em>string</em>) – the name of the weather</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getType">
<code class="descclassname">map.</code><code class="descname">getType</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getType" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the map type for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the name of the map type</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setType">
<code class="descclassname">map.</code><code class="descname">setType</code><span class="sig-paren">(</span><em>type</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setType" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the name of the map type for the currently-opened map. The map type name must be one of the names in the “Type” dropdown menu on the Header tab.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>type</strong> (<em>string</em>) – the name of the map type</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getBattleScene">
<code class="descclassname">map.</code><code class="descname">getBattleScene</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getBattleScene" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the battle scene for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the name of the battle scene</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setBattleScene">
<code class="descclassname">map.</code><code class="descname">setBattleScene</code><span class="sig-paren">(</span><em>battleScene</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setBattleScene" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the name of the battle scene for the currently-opened map. The battle scene name must be one of the names in the “Battle scene” dropdown menu on the Header tab.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>battleScene</strong> (<em>string</em>) – the name of the battle scene</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getShowLocationName">
<code class="descclassname">map.</code><code class="descname">getShowLocationName</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getShowLocationName" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the location name will appear in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">whether the location name will be shown</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setShowLocationName">
<code class="descclassname">map.</code><code class="descname">setShowLocationName</code><span class="sig-paren">(</span><em>show</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setShowLocationName" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets whether the location name should appear in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>show</strong> (<em>boolean</em>) – whether the location name should be shown</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getAllowRunning">
<code class="descclassname">map.</code><code class="descname">getAllowRunning</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getAllowRunning" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether running is allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">whether running is allowed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setAllowRunning">
<code class="descclassname">map.</code><code class="descname">setAllowRunning</code><span class="sig-paren">(</span><em>allow</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setAllowRunning" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets whether running should be allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>allow</strong> (<em>boolean</em>) – whether running should be allowed</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getAllowBiking">
<code class="descclassname">map.</code><code class="descname">getAllowBiking</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getAllowBiking" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether biking is allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">whether biking is allowed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setAllowBiking">
<code class="descclassname">map.</code><code class="descname">setAllowBiking</code><span class="sig-paren">(</span><em>allow</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setAllowBiking" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets whether biking should be allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>allow</strong> (<em>boolean</em>) – whether biking should be allowed</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getAllowEscaping">
<code class="descclassname">map.</code><code class="descname">getAllowEscaping</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getAllowEscaping" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether escaping (using Escape Rope or Dig) is allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">whether escaping is allowed</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setAllowEscaping">
<code class="descclassname">map.</code><code class="descname">setAllowEscaping</code><span class="sig-paren">(</span><em>allow</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setAllowEscaping" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets whether escaping (using Escape Rope or Dig) should be allowed in-game for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>allow</strong> (<em>boolean</em>) – whether escaping should be allowed</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getFloorNumber">
<code class="descclassname">map.</code><code class="descname">getFloorNumber</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getFloorNumber" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the floor number for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the floor number</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setFloorNumber">
<code class="descclassname">map.</code><code class="descname">setFloorNumber</code><span class="sig-paren">(</span><em>floorNumber</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setFloorNumber" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the floor number for the currently-opened map. Floor numbers can be any number between -128 and 127 inclusive.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>floorNumber</strong> (<em>number</em>) – the floor number</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="tileset-functions">
<h4>Tileset Functions<a class="headerlink" href="#tileset-functions" title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to tilesets and how they are rendered. The functions with “preview” in their name operate on a “fake” version of the palette colors. This means that changing these “preview” colors won’t affect the actual tileset colors in the project. A good use of the “preview” palettes would be Day/Night tints, for example.</p>
<p>All tileset functions are callable via the global <code class="docutils literal notranslate"><span class="pre">map</span></code> object.</p>
<dl class="function">
<dt id="map.getPrimaryTileset">
<code class="descclassname">map.</code><code class="descname">getPrimaryTileset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getPrimaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the primary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">primary tileset name</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setPrimaryTileset">
<code class="descclassname">map.</code><code class="descname">setPrimaryTileset</code><span class="sig-paren">(</span><em>tileset</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setPrimaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the primary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>tileset</strong> (<em>string</em>) – the tileset name</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getSecondaryTileset">
<code class="descclassname">map.</code><code class="descname">getSecondaryTileset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getSecondaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the name of the secondary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">secondary tileset name</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSecondaryTileset">
<code class="descclassname">map.</code><code class="descname">setSecondaryTileset</code><span class="sig-paren">(</span><em>tileset</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSecondaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the secondary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>tileset</strong> (<em>string</em>) – the tileset name</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getNumPrimaryTilesetTiles">
<code class="descclassname">map.</code><code class="descname">getNumPrimaryTilesetTiles</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getNumPrimaryTilesetTiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of tiles in the primary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">number of tiles</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getNumSecondaryTilesetTiles">
<code class="descclassname">map.</code><code class="descname">getNumSecondaryTilesetTiles</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getNumSecondaryTilesetTiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of tiles in the secondary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">number of tiles</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getNumPrimaryTilesetMetatiles">
<code class="descclassname">map.</code><code class="descname">getNumPrimaryTilesetMetatiles</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getNumPrimaryTilesetMetatiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of metatiles in the primary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">number of metatiles</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getNumSecondaryTilesetMetatiles">
<code class="descclassname">map.</code><code class="descname">getNumSecondaryTilesetMetatiles</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getNumSecondaryTilesetMetatiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the number of metatiles in the secondary tileset for the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">number of metatiles</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getPrimaryTilesetPalettePreview">
<code class="descclassname">map.</code><code class="descname">getPrimaryTilesetPalettePreview</code><span class="sig-paren">(</span><em>paletteIndex</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getPrimaryTilesetPalettePreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the primary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">array of colors. Each color is a 3-element RGB array</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setPrimaryTilesetPalettePreview">
<code class="descclassname">map.</code><code class="descname">setPrimaryTilesetPalettePreview</code><span class="sig-paren">(</span><em>paletteIndex</em>, <em>colors</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setPrimaryTilesetPalettePreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the primary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
<li><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palette. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getPrimaryTilesetPalettesPreview">
<code class="descclassname">map.</code><code class="descname">getPrimaryTilesetPalettesPreview</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getPrimaryTilesetPalettesPreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the primary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of arrays of colors. Each color is a 3-element RGB array</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setPrimaryTilesetPalettesPreview">
<code class="descclassname">map.</code><code class="descname">setPrimaryTilesetPalettesPreview</code><span class="sig-paren">(</span><em>palettes</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setPrimaryTilesetPalettesPreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the primary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palettes. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getSecondaryTilesetPalettePreview">
<code class="descclassname">map.</code><code class="descname">getSecondaryTilesetPalettePreview</code><span class="sig-paren">(</span><em>paletteIndex</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getSecondaryTilesetPalettePreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the secondary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">array of colors. Each color is a 3-element RGB array</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSecondaryTilesetPalettePreview">
<code class="descclassname">map.</code><code class="descname">setSecondaryTilesetPalettePreview</code><span class="sig-paren">(</span><em>paletteIndex</em>, <em>colors</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSecondaryTilesetPalettePreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the secondary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
<li><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palette. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getSecondaryTilesetPalettesPreview">
<code class="descclassname">map.</code><code class="descname">getSecondaryTilesetPalettesPreview</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getSecondaryTilesetPalettesPreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the secondary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of arrays of colors. Each color is a 3-element RGB array</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSecondaryTilesetPalettesPreview">
<code class="descclassname">map.</code><code class="descname">setSecondaryTilesetPalettesPreview</code><span class="sig-paren">(</span><em>palettes</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSecondaryTilesetPalettesPreview" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the secondary tileset of the currently-opened map. This will NOT affect the true underlying colors–it only displays these colors in the map-editing area of Porymap.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palettes. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getPrimaryTilesetPalette">
<code class="descclassname">map.</code><code class="descname">getPrimaryTilesetPalette</code><span class="sig-paren">(</span><em>paletteIndex</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getPrimaryTilesetPalette" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the primary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">array of colors. Each color is a 3-element RGB array</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setPrimaryTilesetPalette">
<code class="descclassname">map.</code><code class="descname">setPrimaryTilesetPalette</code><span class="sig-paren">(</span><em>paletteIndex</em>, <em>colors</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setPrimaryTilesetPalette" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the primary tileset of the currently-opened map. This will permanently affect the palette and save the palette to disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
<li><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palette. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getPrimaryTilesetPalettes">
<code class="descclassname">map.</code><code class="descname">getPrimaryTilesetPalettes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getPrimaryTilesetPalettes" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the primary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of arrays of colors. Each color is a 3-element RGB array</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setPrimaryTilesetPalettes">
<code class="descclassname">map.</code><code class="descname">setPrimaryTilesetPalettes</code><span class="sig-paren">(</span><em>palettes</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setPrimaryTilesetPalettes" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the primary tileset of the currently-opened map. This will permanently affect the palettes and save the palettes to disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palettes. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getSecondaryTilesetPalette">
<code class="descclassname">map.</code><code class="descname">getSecondaryTilesetPalette</code><span class="sig-paren">(</span><em>paletteIndex</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getSecondaryTilesetPalette" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets a palette from the secondary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">array of colors. Each color is a 3-element RGB array</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSecondaryTilesetPalette">
<code class="descclassname">map.</code><code class="descname">setSecondaryTilesetPalette</code><span class="sig-paren">(</span><em>paletteIndex</em>, <em>colors</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSecondaryTilesetPalette" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a palette in the secondary tileset of the currently-opened map. This will permanently affect the palette and save the palette to disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>paletteIndex</strong> (<em>number</em>) – the palette index</li>
<li><strong>colors</strong> (<em>array</em>) – array of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palette. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getSecondaryTilesetPalettes">
<code class="descclassname">map.</code><code class="descname">getSecondaryTilesetPalettes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#map.getSecondaryTilesetPalettes" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets all of the palettes from the secondary tileset of the currently-opened map.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of arrays of colors. Each color is a 3-element RGB array</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setSecondaryTilesetPalettes">
<code class="descclassname">map.</code><code class="descname">setSecondaryTilesetPalettes</code><span class="sig-paren">(</span><em>palettes</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setSecondaryTilesetPalettes" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets all of the palettes in the secondary tileset of the currently-opened map. This will permanently affect the palettes and save the palettes to disk.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>palettes</strong> (<em>array</em>) – array of arrays of colors. Each color is a 3-element RGB array</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Redraw the elements with the updated palettes. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the elements that use palettes is expensive, so it can be useful to batch together many calls to palette functions and only set <code class="docutils literal notranslate"><span class="pre">redraw</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> on the final call.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileLabel">
<code class="descclassname">map.</code><code class="descname">getMetatileLabel</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileLabel" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the label for the specified metatile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the label</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileLabel">
<code class="descclassname">map.</code><code class="descname">setMetatileLabel</code><span class="sig-paren">(</span><em>metatileId</em>, <em>label</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileLabel" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the label for the specified metatile. A label can only consist of letters, numbers, and underscores.</p>
<p><strong>Warning:</strong> This function writes directly to the project. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>label</strong> (<em>string</em>) – the label</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileLayerType">
<code class="descclassname">map.</code><code class="descname">getMetatileLayerType</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileLayerType" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the layer type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: Middle/Top, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Bottom/Middle, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Bottom/Top.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the layer type</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileLayerType">
<code class="descclassname">map.</code><code class="descname">setMetatileLayerType</code><span class="sig-paren">(</span><em>metatileId</em>, <em>layerType</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileLayerType" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the layer type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: Middle/Top, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Bottom/Middle, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Bottom/Top.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>layerType</strong> (<em>number</em>) – the layer type</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileEncounterType">
<code class="descclassname">map.</code><code class="descname">getMetatileEncounterType</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileEncounterType" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the encounter type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: None, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Land, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Water</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the encounter type</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileEncounterType">
<code class="descclassname">map.</code><code class="descname">setMetatileEncounterType</code><span class="sig-paren">(</span><em>metatileId</em>, <em>encounterType</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileEncounterType" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the encounter type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: None, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Land, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Water</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>encounterType</strong> (<em>number</em>) – the encounter type</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileTerrainType">
<code class="descclassname">map.</code><code class="descname">getMetatileTerrainType</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileTerrainType" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the terrain type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: None, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Grass, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Water, <code class="docutils literal notranslate"><span class="pre">3</span></code>: Waterfall</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the terrain type</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileTerrainType">
<code class="descclassname">map.</code><code class="descname">setMetatileTerrainType</code><span class="sig-paren">(</span><em>metatileId</em>, <em>terrainType</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileTerrainType" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the terrain type for the specified metatile. <code class="docutils literal notranslate"><span class="pre">0</span></code>: None, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Grass, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Water, <code class="docutils literal notranslate"><span class="pre">3</span></code>: Waterfall</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>terrainType</strong> (<em>number</em>) – the terrain type</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileBehavior">
<code class="descclassname">map.</code><code class="descname">getMetatileBehavior</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileBehavior" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the behavior for the specified metatile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the behavior</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileBehavior">
<code class="descclassname">map.</code><code class="descname">setMetatileBehavior</code><span class="sig-paren">(</span><em>metatileId</em>, <em>behavior</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileBehavior" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the behavior for the specified metatile.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>behavior</strong> (<em>number</em>) – the behavior</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileBehaviorName">
<code class="descclassname">map.</code><code class="descname">getMetatileBehaviorName</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileBehaviorName" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the behavior name for the specified metatile. Returns an empty string if the metatile’s behavior value has no name.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the behavior name</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">string</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileBehaviorName">
<code class="descclassname">map.</code><code class="descname">setMetatileBehaviorName</code><span class="sig-paren">(</span><em>metatileId</em>, <em>behavior</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileBehaviorName" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the behavior name for the specified metatile. Does nothing if there is no metatile behavior define with the specified name.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>behavior</strong> (<em>string</em>) – the behavior name</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileAttributes">
<code class="descclassname">map.</code><code class="descname">getMetatileAttributes</code><span class="sig-paren">(</span><em>metatileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileAttributes" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the raw attributes value for the specified metatile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the raw attributes value</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileAttributes">
<code class="descclassname">map.</code><code class="descname">setMetatileAttributes</code><span class="sig-paren">(</span><em>metatileId</em>, <em>attributes</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileAttributes" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the raw attributes value for the specified metatile.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this. Porymap will not limit the value of existing attributes to their usual range.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>attributes</strong> (<em>number</em>) – the raw attributes value</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileTile">
<code class="descclassname">map.</code><code class="descname">getMetatileTile</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tileIndex</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileTile" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the tile at the specified index of the metatile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tileIndex</strong> (<em>number</em>) – index of the tile to get</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the tile</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{tileId,</span> <span class="pre">xflip,</span> <span class="pre">yflip,</span> <span class="pre">palette}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getMetatileTiles">
<code class="descclassname">map.</code><code class="descname">getMetatileTiles</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tileStart = 0</em>, <em>tileEnd = -1</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getMetatileTiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the tiles in the specified range of the metatile.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tileStart</strong> (<em>number</em>) – index of the first tile to get. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code> (the first tile)</li>
<li><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to get. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code> (the last tile)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">array of tiles in the specified range. Each tile is an object of the form <code class="docutils literal notranslate"><span class="pre">{tileId,</span> <span class="pre">xflip,</span> <span class="pre">yflip,</span> <span class="pre">palette}</span></code></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">array</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileTile">
<code class="descclassname">map.</code><code class="descname">setMetatileTile</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tileIndex</em>, <em>tileId</em>, <em>xflip</em>, <em>yflip</em>, <em>palette</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileTile" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tile at the specified index of the metatile.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tileIndex</strong> (<em>number</em>) – index of the tile to set</li>
<li><strong>tileId</strong> (<em>number</em>) – new tile’s value</li>
<li><strong>xflip</strong> (<em>boolean</em>) – whether the new tile is flipped horizontally</li>
<li><strong>yflip</strong> (<em>boolean</em>) – whether the new tile is flipped vertically</li>
<li><strong>palette</strong> (<em>number</em>) – new tile’s palette number</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">map.</code><code class="descname">setMetatileTile</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tileIndex</em>, <em>tile</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span></dt>
<dd><p>Sets the tile at the specified index of the metatile. This is an overloaded function that takes a single tile as a JavaScript object instead of each of the tile’s properties individually.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tileIndex</strong> (<em>number</em>) – index of the tile to set</li>
<li><strong>tile</strong> (<em>object</em>) – the new tile. <code class="docutils literal notranslate"><span class="pre">tile</span></code> is an object with the properties <code class="docutils literal notranslate"><span class="pre">{tileId,</span> <span class="pre">xflip,</span> <span class="pre">yflip,</span> <span class="pre">palette}</span></code></li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.setMetatileTiles">
<code class="descclassname">map.</code><code class="descname">setMetatileTiles</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tileId</em>, <em>xflip</em>, <em>yflip</em>, <em>palette</em>, <em>tileStart = 0</em>, <em>tileEnd = -1</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span><a class="headerlink" href="#map.setMetatileTiles" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the tiles in the specified range of the metatile. All tiles in the specified range will be set using the same given values.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tileId</strong> (<em>number</em>) – new tiles’ value</li>
<li><strong>xflip</strong> (<em>boolean</em>) – whether the new tiles are flipped horizontally</li>
<li><strong>yflip</strong> (<em>boolean</em>) – whether the new tiles are flipped vertically</li>
<li><strong>palette</strong> (<em>number</em>) – new tiles’ palette number</li>
<li><strong>tileStart</strong> (<em>number</em>) – index of the first tile to set. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code> (the first tile)</li>
<li><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to set. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code> (the last tile)</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">map.</code><code class="descname">setMetatileTiles</code><span class="sig-paren">(</span><em>metatileId</em>, <em>tiles</em>, <em>tileStart = 0</em>, <em>tileEnd = -1</em>, <em>forceRedraw = true</em><span class="sig-paren">)</span></dt>
<dd><p>Sets the tiles in the specified range of the metatile. This is an overloaded function that takes an array of tiles as JavaScript objects instead of each of the tile properties individually.</p>
<p><strong>Warning:</strong> This function writes directly to the tileset. There is no undo for this.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>metatileId</strong> (<em>number</em>) – id of target metatile</li>
<li><strong>tiles</strong> (<em>array</em>) – array of tiles to set. Each tile is an object of the form <code class="docutils literal notranslate"><span class="pre">{tileId,</span> <span class="pre">xflip,</span> <span class="pre">yflip,</span> <span class="pre">palette}</span></code>. If the array does not have sufficient objects to set all the tiles in the specified range then the remaining tiles will be set with all default values.</li>
<li><strong>tileStart</strong> (<em>number</em>) – index of the first tile to set. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code> (the first tile)</li>
<li><strong>tileEnd</strong> (<em>number</em>) – index of the last tile to set. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code> (the last tile)</li>
<li><strong>forceRedraw</strong> (<em>boolean</em>) – Force the map view to refresh. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Redrawing the map view is expensive, so set to <code class="docutils literal notranslate"><span class="pre">false</span></code> when making many consecutive map edits, and then redraw the map once using <code class="docutils literal notranslate"><span class="pre">map.redraw()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="map.getTilePixels">
<code class="descclassname">map.</code><code class="descname">getTilePixels</code><span class="sig-paren">(</span><em>tileId</em><span class="sig-paren">)</span><a class="headerlink" href="#map.getTilePixels" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the pixel data for the specified tile. The pixel data is an array of indexes indicating which palette color each pixel uses. Tiles are 8x8, so the pixel array will be 64 elements long.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the pixel data</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="overlay-functions">
<h4>Overlay Functions<a class="headerlink" href="#overlay-functions" title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to an overlay that is drawn on top of the map area. Text, images, and shapes can be drawn using these functions. Items can be drawn and manipulated on separate layers by specifiying a layer id. Items on higher layer ids will be drawn above those on lower layers. The visibility, opacity, position, rotation, and scale of each layer can be changed; by default all layers are visible, have an opacity of <code class="docutils literal notranslate"><span class="pre">100</span></code>, are at position <code class="docutils literal notranslate"><span class="pre">0,0</span></code>, an angle of <code class="docutils literal notranslate"><span class="pre">0</span></code>, and a horizontal and vertical scale of <code class="docutils literal notranslate"><span class="pre">1.0</span></code>.</p>
<p>All overlay functions are callable via the global <code class="docutils literal notranslate"><span class="pre">overlay</span></code> object.</p>
<dl class="function">
<dt id="overlay.clear">
<code class="descclassname">overlay.</code><code class="descname">clear</code><span class="sig-paren">(</span><em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.clear" title="Permalink to this definition">¶</a></dt>
<dd><p>Clears and erases all previously-added overlay items on the specified layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Clears and erases all previously-added overlay items on every layer.</p>
</dd></dl>

<dl class="function">
<dt id="overlay.hide">
<code class="descclassname">overlay.</code><code class="descname">hide</code><span class="sig-paren">(</span><em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.hide" title="Permalink to this definition">¶</a></dt>
<dd><p>Hides all overlay items on the specified layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">hide</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Hides all overlay items on all active layers. Layers that have not been used yet will not be hidden.</p>
</dd></dl>

<dl class="function">
<dt id="overlay.show">
<code class="descclassname">overlay.</code><code class="descname">show</code><span class="sig-paren">(</span><em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.show" title="Permalink to this definition">¶</a></dt>
<dd><p>Shows all overlay items on the specified layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">show</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Shows all overlay items on all active layers.</p>
</dd></dl>

<dl class="function">
<dt id="overlay.getVisibility">
<code class="descclassname">overlay.</code><code class="descname">getVisibility</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified overlay layer is currently showing or not.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">whether the layer is showing</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">boolean</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setVisibility">
<code class="descclassname">overlay.</code><code class="descname">setVisibility</code><span class="sig-paren">(</span><em>visible</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>visible</strong> (<em>boolean</em>) – whether the layer should be showing</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setVisibility</code><span class="sig-paren">(</span><em>visible</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the visibility of all active overlay layers.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>visible</strong> (<em>boolean</em>) – whether the layers should be showing</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getOpacity">
<code class="descclassname">overlay.</code><code class="descname">getOpacity</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getOpacity" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the opacity of the specified overlay layer. Opacity ranges from <code class="docutils literal notranslate"><span class="pre">0</span></code> (invisible) to <code class="docutils literal notranslate"><span class="pre">100</span></code> (completely opaque).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the opacity</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setOpacity">
<code class="descclassname">overlay.</code><code class="descname">setOpacity</code><span class="sig-paren">(</span><em>opacity</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setOpacity" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the opacity of the specified overlay layer. Opacity ranges from <code class="docutils literal notranslate"><span class="pre">0</span></code> (invisible) to <code class="docutils literal notranslate"><span class="pre">100</span></code> (completely opaque).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>opacity</strong> (<em>number</em>) – the opacity</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setOpacity</code><span class="sig-paren">(</span><em>opacity</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the opacity of all active overlay layers. Layers that have not been used yet will not have their opacity changed. Opacity ranges from <code class="docutils literal notranslate"><span class="pre">0</span></code> (invisible) to <code class="docutils literal notranslate"><span class="pre">100</span></code> (completely opaque).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>opacity</strong> (<em>number</em>) – the opacity</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getHorizontalScale">
<code class="descclassname">overlay.</code><code class="descname">getHorizontalScale</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getHorizontalScale" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the horizontal scale of the specified overlay layer. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the scale</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getVerticalScale">
<code class="descclassname">overlay.</code><code class="descname">getVerticalScale</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getVerticalScale" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the vertical scale of the specified overlay layer. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the scale</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setHorizontalScale">
<code class="descclassname">overlay.</code><code class="descname">setHorizontalScale</code><span class="sig-paren">(</span><em>scale</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setHorizontalScale" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the horizontal scale of the specified overlay layer. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>scale</strong> (<em>number</em>) – the scale to set</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setHorizontalScale</code><span class="sig-paren">(</span><em>scale</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the horizontal scale of all active overlay layers. Layers that have not been used yet will not have their scale changed. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>scale</strong> (<em>number</em>) – the scale to set</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setVerticalScale">
<code class="descclassname">overlay.</code><code class="descname">setVerticalScale</code><span class="sig-paren">(</span><em>scale</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setVerticalScale" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the vertical scale of the specified overlay layer. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>scale</strong> (<em>number</em>) – the scale to set</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setVerticalScale</code><span class="sig-paren">(</span><em>scale</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the vertical scale of all active overlay layers. Layers that have not been used yet will not have their scale changed. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>scale</strong> (<em>number</em>) – the scale to set</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setScale">
<code class="descclassname">overlay.</code><code class="descname">setScale</code><span class="sig-paren">(</span><em>hScale</em>, <em>vScale</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setScale" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the horizontal and vertical scale of the specified overlay layer. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>hScale</strong> (<em>number</em>) – the horizontal scale to set</li>
<li><strong>vScale</strong> (<em>number</em>) – the vertical scale to set</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setScale</code><span class="sig-paren">(</span><em>hScale</em>, <em>vScale</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the horizontal and vertical scale of all active overlay layers. Layers that have not been used yet will not have their scale changed. <code class="docutils literal notranslate"><span class="pre">1.0</span></code> is normal size.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>hScale</strong> (<em>number</em>) – the horizontal scale to set</li>
<li><strong>vScale</strong> (<em>number</em>) – the vertical scale to set</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getRotation">
<code class="descclassname">overlay.</code><code class="descname">getRotation</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getRotation" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the angle the specified overlay layer is rotated to.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the angle the layer is rotated to</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setRotation">
<code class="descclassname">overlay.</code><code class="descname">setRotation</code><span class="sig-paren">(</span><em>angle</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setRotation" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the angle the specified overlay layer is rotated to.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>angle</strong> (<em>number</em>) – the angle to set</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setRotation</code><span class="sig-paren">(</span><em>angle</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the angle that all active overlay layers are rotated to. Layers that have not been used yet will not have their angle changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>angle</strong> (<em>number</em>) – the angle to set</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.rotate">
<code class="descclassname">overlay.</code><code class="descname">rotate</code><span class="sig-paren">(</span><em>degrees</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.rotate" title="Permalink to this definition">¶</a></dt>
<dd><p>Rotates the specified overlay layer. A positive number of degrees is clockwise rotation, a negative number of degrees is counterclockwise rotation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>degrees</strong> (<em>number</em>) – the number of degrees to rotate</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">rotate</code><span class="sig-paren">(</span><em>degrees</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Rotates the all active overlay layers. Layers that have not been used yet will not be rotated. A positive number of degrees is clockwise rotation, a negative number of degrees is counterclockwise rotation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>degrees</strong> (<em>number</em>) – the number of degrees to rotate</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getX">
<code class="descclassname">overlay.</code><code class="descname">getX</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getX" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the x position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the pixel x coordinate</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.getY">
<code class="descclassname">overlay.</code><code class="descname">getY</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getY" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the y position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the pixel y coordinate</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">number</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setX">
<code class="descclassname">overlay.</code><code class="descname">setX</code><span class="sig-paren">(</span><em>x</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setX" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the x position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the pixel x coordinate</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setX</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the x position of all active overlay layers. Layers that have not been used yet will not have their position changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the pixel x coordinate</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setY">
<code class="descclassname">overlay.</code><code class="descname">setY</code><span class="sig-paren">(</span><em>y</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setY" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the y position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>y</strong> (<em>number</em>) – the pixel y coordinate</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setY</code><span class="sig-paren">(</span><em>y</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the y position of all active overlay layers. Layers that have not been used yet will not have their position changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>y</strong> (<em>number</em>) – the pixel y coordinate</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setClippingRect">
<code class="descclassname">overlay.</code><code class="descname">setClippingRect</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>width</em>, <em>height</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setClippingRect" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the rectangular clipping region for the specifieid overlay layer. A clipping region will cause the overlay’s rendering to be contained inside it. In other words, any content from the overlay layer will not be visible outside of the specified rectangle.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the rectangle’s pixel x coordinate, 0 is the left edge of the current map. A negative value is where the left map border’s region is</li>
<li><strong>y</strong> (<em>number</em>) – the rectangle’s pixel y coordinate, 0 is the top edge of the current map. A negative value is where the top map border’s region is</li>
<li><strong>width</strong> (<em>number</em>) – the rectangle’s pixel width</li>
<li><strong>height</strong> (<em>number</em>) – the rectangle’s pixel height</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setClippingRect</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>width</em>, <em>height</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the rectangular clipping region for all overlay layers. A clipping region will cause the overlay’s rendering to be contained inside it. In other words, any content from the overlay layer will not be visible outside of the specified rectangle.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the rectangle’s pixel x coordinate, 0 is the left edge of the current map. A negative value is where the left map border’s region is</li>
<li><strong>y</strong> (<em>number</em>) – the rectangle’s pixel y coordinate, 0 is the top edge of the current map. A negative value is where the top map border’s region is</li>
<li><strong>width</strong> (<em>number</em>) – the rectangle’s pixel width</li>
<li><strong>height</strong> (<em>number</em>) – the rectangle’s pixel height</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.clearClippingRect">
<code class="descclassname">overlay.</code><code class="descname">clearClippingRect</code><span class="sig-paren">(</span><em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.clearClippingRect" title="Permalink to this definition">¶</a></dt>
<dd><p>Clears any clipping for the specified overlay layer. See <code class="docutils literal notranslate"><span class="pre">setClippingRect</span></code> for more info about clipping.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">clearClippingRect</code><span class="sig-paren">(</span><span class="sig-paren">)</span></dt>
<dd><p>Clears any clipping for all overlay layers. See <code class="docutils literal notranslate"><span class="pre">setClippingRect</span></code> for more info about clipping.</p>
</dd></dl>

<dl class="function">
<dt id="overlay.getPosition">
<code class="descclassname">overlay.</code><code class="descname">getPosition</code><span class="sig-paren">(</span><em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.getPosition" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the layer’s pixel coordinates</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{x,</span> <span class="pre">y}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.setPosition">
<code class="descclassname">overlay.</code><code class="descname">setPosition</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.setPosition" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the position of the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the pixel x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – the pixel y coordinate</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">setPosition</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Sets the position of all active overlay layers. Layers that have not been used yet will not have their position changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the pixel x coordinate</li>
<li><strong>y</strong> (<em>number</em>) – the pixel y coordinate</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.move">
<code class="descclassname">overlay.</code><code class="descname">move</code><span class="sig-paren">(</span><em>deltaX</em>, <em>deltaY</em>, <em>layer</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.move" title="Permalink to this definition">¶</a></dt>
<dd><p>Moves the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>deltaX</strong> (<em>number</em>) – the number of pixels to move horizontally</li>
<li><strong>deltaY</strong> (<em>number</em>) – the number of pixels to move vertically</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">move</code><span class="sig-paren">(</span><em>deltaX</em>, <em>deltaY</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Moves all active overlay layers. Layers that have not been used yet will not have their position changed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>deltaX</strong> (<em>number</em>) – the number of pixels to move horizontally</li>
<li><strong>deltaY</strong> (<em>number</em>) – the number of pixels to move vertically</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addText">
<code class="descclassname">overlay.</code><code class="descname">addText</code><span class="sig-paren">(</span><em>text</em>, <em>x</em>, <em>y</em>, <em>color = &quot;#000000&quot;</em>, <em>size = 12</em>, <em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addText" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds a text item to the specified overlay layer. Text can be additionally formatted with a <a class="reference external" href="https://doc.qt.io/qt-5/richtext-html-subset.html#supported-tags">limited set of HTML tags</a>. Note that only text can be displayed, so text decoration like underlines or table borders will not appear.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>text</strong> (<em>string</em>) – the text to display</li>
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the text (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the text (relative to the layer’s position)</li>
<li><strong>color</strong> (<em>string</em>) – the color of the text. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to black.</li>
<li><strong>size</strong> (<em>number</em>) – the font size of the text. Defaults to 12.</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addRect">
<code class="descclassname">overlay.</code><code class="descname">addRect</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>width</em>, <em>height</em>, <em>borderColor = &quot;#000000&quot;</em>, <em>fillColor = &quot;&quot;</em>, <em>rounding = 0</em>, <em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addRect" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds a rectangle outline item to the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the rectangle’s top-left corner (relative to the layer’s position)</li>
<li><strong>width</strong> (<em>number</em>) – the pixel width of the rectangle</li>
<li><strong>height</strong> (<em>number</em>) – the pixel height of the rectangle</li>
<li><strong>borderColor</strong> (<em>string</em>) – the color of the rectangle’s border. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to black.</li>
<li><strong>fillColor</strong> (<em>string</em>) – the color of the area enclosed by the rectangle. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to transparent.</li>
<li><strong>rounding</strong> (<em>number</em>) – the percent degree the corners will be rounded. <code class="docutils literal notranslate"><span class="pre">0</span></code> is rectangular, <code class="docutils literal notranslate"><span class="pre">100</span></code> is elliptical. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addPath">
<code class="descclassname">overlay.</code><code class="descname">addPath</code><span class="sig-paren">(</span><em>coords</em>, <em>borderColor = &quot;#000000&quot;</em>, <em>fillColor = &quot;&quot;</em>, <em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addPath" title="Permalink to this definition">¶</a></dt>
<dd><p>Draws a straight path on the specified layer by connecting the coordinate pairs in <code class="docutils literal notranslate"><span class="pre">coords</span></code>. The area enclosed by the path can be colored in, and will follow the <a class="reference external" href="https://doc.qt.io/qt-5/qt.html#FillRule-enum">“odd-even” fill rule</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>coords</strong> (<em>array</em>) – array of pixel coordinates to connect to create the path. Each element of the array should be an array containing an x and y pixel coordinate</li>
<li><strong>borderColor</strong> (<em>string</em>) – the color of the path. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to black.</li>
<li><strong>fillColor</strong> (<em>string</em>) – the color of the area enclosed by the path. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to transparent.</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">addPath</code><span class="sig-paren">(</span><em>xCoords</em>, <em>yCoords</em>, <em>borderColor = &quot;#000000&quot;</em>, <em>fillColor = &quot;&quot;</em>, <em>layer = 0</em><span class="sig-paren">)</span></dt>
<dd><p>This is an overloaded function. Draws a straight path on the specified layer by connecting the coordinates at (<code class="docutils literal notranslate"><span class="pre">xCoords</span></code>, <code class="docutils literal notranslate"><span class="pre">yCoords</span></code>). The area enclosed by the path can be colored in, and will follow the <a class="reference external" href="https://doc.qt.io/qt-5/qt.html#FillRule-enum">“odd-even” fill rule</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>xCoords</strong> (<em>array</em>) – array of x pixel coordinates to connect to create the path</li>
<li><strong>yCoords</strong> (<em>array</em>) – array of y pixel coordinates to connect to create the path</li>
<li><strong>borderColor</strong> (<em>string</em>) – the color of the path. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to black.</li>
<li><strong>fillColor</strong> (<em>string</em>) – the color of the area enclosed by the path. Can be specified as <code class="docutils literal notranslate"><span class="pre">&quot;#RRGGBB&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;#AARRGGBB&quot;</span></code>. Defaults to transparent.</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addImage">
<code class="descclassname">overlay.</code><code class="descname">addImage</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>filepath</em>, <em>layer = 0</em>, <em>useCache = true</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addImage" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds an image item to the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>filepath</strong> (<em>string</em>) – the image’s filepath</li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>useCache</strong> (<em>boolean</em>) – whether the image should be saved/loaded using the cache. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Reading images from a file is slow. Setting <code class="docutils literal notranslate"><span class="pre">useCache</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> will save the image to memory so that the next time the filepath is encountered the image can be loaded from memory rather than the file.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.createImage">
<code class="descclassname">overlay.</code><code class="descname">createImage</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>filepath</em>, <em>width = -1</em>, <em>height = -1</em>, <em>xOffset = 0</em>, <em>yOffset = 0</em>, <em>hScale = 1</em>, <em>vScale = 1</em>, <em>paletteId = -1</em>, <em>setTransparency = false</em>, <em>layer = 0</em>, <em>useCache = true</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.createImage" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates an image item on the specified overlay layer. This differs from <code class="docutils literal notranslate"><span class="pre">overlay.addImage</span></code> by allowing the new image to be a transformation of the image file.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>filepath</strong> (<em>string</em>) – the image’s filepath</li>
<li><strong>width</strong> (<em>number</em>) – the width in pixels of the area to read in the image. If <code class="docutils literal notranslate"><span class="pre">-1</span></code>, use the full width of the original image. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code></li>
<li><strong>height</strong> (<em>number</em>) – the height in pixels of the area to read in the image. If <code class="docutils literal notranslate"><span class="pre">-1</span></code>, use the full height of the original image. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code></li>
<li><strong>xOffset</strong> (<em>number</em>) – the x pixel coordinate on the original image where data should be read from. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>yOffset</strong> (<em>number</em>) – the y pixel coordinate on the original image where data should be read from. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>hScale</strong> (<em>number</em>) – the horizontal scale for the image. Negative values will be a horizontal flip of the original image. Defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code></li>
<li><strong>vScale</strong> (<em>number</em>) – the vertical scale for the image. Negative values will be a vertical flip of the original image. Defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code></li>
<li><strong>paletteId</strong> (<em>number</em>) – the id of which currently loaded tileset palette to use for the image. If <code class="docutils literal notranslate"><span class="pre">-1</span></code>, use the original image’s palette. Defaults to <code class="docutils literal notranslate"><span class="pre">-1</span></code></li>
<li><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code></li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>useCache</strong> (<em>boolean</em>) – whether the image should be saved/loaded using the cache. Defaults to <code class="docutils literal notranslate"><span class="pre">true</span></code>. Reading images from a file is slow. Setting <code class="docutils literal notranslate"><span class="pre">useCache</span></code> to <code class="docutils literal notranslate"><span class="pre">true</span></code> will save the image to memory so that the next time the filepath is encountered the image can be loaded from memory rather than the file.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addTileImage">
<code class="descclassname">overlay.</code><code class="descname">addTileImage</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>tileId</em>, <em>xflip</em>, <em>yflip</em>, <em>palette</em>, <em>setTransparency = false</em>, <em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addTileImage" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates an image of a tile on the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>tileId</strong> (<em>number</em>) – tile value for the image</li>
<li><strong>xflip</strong> (<em>boolean</em>) – whether the tile image is flipped horizontally</li>
<li><strong>yflip</strong> (<em>boolean</em>) – whether the tile image is flipped vertically</li>
<li><strong>palette</strong> (<em>number</em>) – palette number for the tile image</li>
<li><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code></li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt>
<code class="descclassname">overlay.</code><code class="descname">addTileImage</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>tile</em>, <em>setTransparency = false</em>, <em>layer = 0</em><span class="sig-paren">)</span></dt>
<dd><p>Creates an image of a tile on the specified overlay layer. This is an overloaded function that takes a single tile as a JavaScript object instead of each of the tile’s properties individually.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>tile</strong> (<em>object</em>) – the tile to create an image of. <code class="docutils literal notranslate"><span class="pre">tile</span></code> is an object with the properties <code class="docutils literal notranslate"><span class="pre">{tileId,</span> <span class="pre">xflip,</span> <span class="pre">yflip,</span> <span class="pre">palette}</span></code></li>
<li><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code></li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="overlay.addMetatileImage">
<code class="descclassname">overlay.</code><code class="descname">addMetatileImage</code><span class="sig-paren">(</span><em>x</em>, <em>y</em>, <em>metatileId</em>, <em>setTransparency = false</em>, <em>layer = 0</em><span class="sig-paren">)</span><a class="headerlink" href="#overlay.addMetatileImage" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates an image of a metatile on the specified overlay layer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>x</strong> (<em>number</em>) – the x pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>y</strong> (<em>number</em>) – the y pixel coordinate of the image’s top-left corner (relative to the layer’s position)</li>
<li><strong>metatileId</strong> (<em>number</em>) – id of the metatile to create an image of</li>
<li><strong>setTransparency</strong> (<em>boolean</em>) – whether the color at index 0 should be overwritten with transparent pixels. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code></li>
<li><strong>layer</strong> (<em>number</em>) – the layer id. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="settings-functions">
<h4>Settings Functions<a class="headerlink" href="#settings-functions" title="Permalink to this headline">¶</a></h4>
<p>The following functions are related to settings.</p>
<p>All settings functions are callable via the global <code class="docutils literal notranslate"><span class="pre">utility</span></code> object.</p>
<dl class="function">
<dt id="utility.getGridVisibility">
<code class="descclassname">utility.</code><code class="descname">getGridVisibility</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getGridVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the visibility of the map grid overlay.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">grid visibility</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setGridVisibility">
<code class="descclassname">utility.</code><code class="descname">setGridVisibility</code><span class="sig-paren">(</span><em>visible</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setGridVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the map grid overlay.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>visible</strong> (<em>boolean</em>) – grid visibility</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getBorderVisibility">
<code class="descclassname">utility.</code><code class="descname">getBorderVisibility</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getBorderVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the visibility of the map’s border.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">border visibility</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setBorderVisibility">
<code class="descclassname">utility.</code><code class="descname">setBorderVisibility</code><span class="sig-paren">(</span><em>visible</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setBorderVisibility" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the visibility of the map’s border.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>visible</strong> (<em>boolean</em>) – border visibility</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getSmartPathsEnabled">
<code class="descclassname">utility.</code><code class="descname">getSmartPathsEnabled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getSmartPathsEnabled" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the toggle state of smart paths.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">smart paths enabled</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">boolean</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setSmartPathsEnabled">
<code class="descclassname">utility.</code><code class="descname">setSmartPathsEnabled</code><span class="sig-paren">(</span><em>enabled</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setSmartPathsEnabled" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the toggle state of smart paths.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>enabled</strong> (<em>boolean</em>) – smart paths enabled</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getCustomScripts">
<code class="descclassname">utility.</code><code class="descname">getCustomScripts</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getCustomScripts" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of paths to custom scripts.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">string array of custom scripts paths</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMainTab">
<code class="descclassname">utility.</code><code class="descname">getMainTab</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMainTab" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the index of the currently selected main tab. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Map, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Events, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Header, <code class="docutils literal notranslate"><span class="pre">3</span></code>: Connections, <code class="docutils literal notranslate"><span class="pre">4</span></code>: Wild Pokemon).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">current main tab index</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setMainTab">
<code class="descclassname">utility.</code><code class="descname">setMainTab</code><span class="sig-paren">(</span><em>tab</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setMainTab" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the currently selected main tab. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Map, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Events, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Header, <code class="docutils literal notranslate"><span class="pre">3</span></code>: Connections, <code class="docutils literal notranslate"><span class="pre">4</span></code>: Wild Pokemon).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>tab</strong> (<em>number</em>) – index of the tab to select</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMapViewTab">
<code class="descclassname">utility.</code><code class="descname">getMapViewTab</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMapViewTab" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the index of the currently selected map view tab. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Metatiles, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Collision, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Prefabs).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">current map view tab index</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">number</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setMapViewTab">
<code class="descclassname">utility.</code><code class="descname">setMapViewTab</code><span class="sig-paren">(</span><em>tab</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setMapViewTab" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the currently selected map view tab. Tabs are indexed from left to right, starting at 0 (<code class="docutils literal notranslate"><span class="pre">0</span></code>: Metatiles, <code class="docutils literal notranslate"><span class="pre">1</span></code>: Collision, <code class="docutils literal notranslate"><span class="pre">2</span></code>: Prefabs).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>tab</strong> (<em>number</em>) – index of the tab to select</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMetatileLayerOrder">
<code class="descclassname">utility.</code><code class="descname">getMetatileLayerOrder</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMetatileLayerOrder" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the order that metatile layers are rendered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of layers. The bottom layer is represented as 0.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setMetatileLayerOrder">
<code class="descclassname">utility.</code><code class="descname">setMetatileLayerOrder</code><span class="sig-paren">(</span><em>order</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setMetatileLayerOrder" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the order that metatile layers are rendered.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>order</strong> (<em>array</em>) – array of layers. The bottom layer is represented as 0.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMetatileLayerOpacity">
<code class="descclassname">utility.</code><code class="descname">getMetatileLayerOpacity</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMetatileLayerOpacity" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the opacities that metatile layers are rendered with.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">array of opacities for each layer. The bottom layer is the first element.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setMetatileLayerOpacity">
<code class="descclassname">utility.</code><code class="descname">setMetatileLayerOpacity</code><span class="sig-paren">(</span><em>opacities</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setMetatileLayerOpacity" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the opacities that metatile layers are rendered with.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>opacities</strong> (<em>array</em>) – array of opacities for each layer. The bottom layer is the first element.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="utility-functions">
<h4>Utility Functions<a class="headerlink" href="#utility-functions" title="Permalink to this headline">¶</a></h4>
<p>These are some miscellaneous functions that can be very useful when building custom scripts.</p>
<p>All utility functions are callable via the global <code class="docutils literal notranslate"><span class="pre">utility</span></code> object.</p>
<dl class="function">
<dt id="utility.registerAction">
<code class="descclassname">utility.</code><code class="descname">registerAction</code><span class="sig-paren">(</span><em>functionName</em>, <em>actionName</em>, <em>shortcut = &quot;&quot;</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.registerAction" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a JavaScript function to an action that can be manually triggered in Porymap’s <code class="docutils literal notranslate"><span class="pre">Tools</span></code> menu. Optionally, a keyboard shortcut (e.g. <code class="docutils literal notranslate"><span class="pre">&quot;Ctrl+P&quot;</span></code>) can also be specified, assuming it doesn’t collide with any existing shortcuts used by Porymap. The function specified by <code class="docutils literal notranslate"><span class="pre">functionName</span></code> must have the <code class="docutils literal notranslate"><span class="pre">export</span></code> keyword.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>functionName</strong> (<em>string</em>) – name of the JavaScript function</li>
<li><strong>actionName</strong> (<em>string</em>) – name of the action that will be displayed in the <code class="docutils literal notranslate"><span class="pre">Tools</span></code> menu</li>
<li><strong>shortcut</strong> (<em>string</em>) – optional keyboard shortcut</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.registerToggleAction">
<code class="descclassname">utility.</code><code class="descname">registerToggleAction</code><span class="sig-paren">(</span><em>functionName</em>, <em>actionName</em>, <em>shortcut = &quot;&quot;</em>, <em>checked = false</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.registerToggleAction" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a JavaScript function to an action that can be manually triggered in Porymap’s <code class="docutils literal notranslate"><span class="pre">Tools</span></code> menu. Optionally, a keyboard shortcut (e.g. <code class="docutils literal notranslate"><span class="pre">&quot;Ctrl+P&quot;</span></code>) can also be specified, assuming it doesn’t collide with any existing shortcuts used by Porymap. A check mark will be toggled next to the action name each time its activated. Whether the check mark is initially present can be set with <code class="docutils literal notranslate"><span class="pre">checked</span></code>. The function specified by <code class="docutils literal notranslate"><span class="pre">functionName</span></code> must have the <code class="docutils literal notranslate"><span class="pre">export</span></code> keyword.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>functionName</strong> (<em>string</em>) – name of the JavaScript function</li>
<li><strong>actionName</strong> (<em>string</em>) – name of the action that will be displayed in the <code class="docutils literal notranslate"><span class="pre">Tools</span></code> menu</li>
<li><strong>shortcut</strong> (<em>string</em>) – optional keyboard shortcut</li>
<li><strong>checked</strong> (<em>boolean</em>) – whether the action initially has a check mark. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.setTimeout">
<code class="descclassname">utility.</code><code class="descname">setTimeout</code><span class="sig-paren">(</span><em>func</em>, <em>delayMs</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.setTimeout" title="Permalink to this definition">¶</a></dt>
<dd><p>This behaves essentially the same as JavaScript’s <code class="docutils literal notranslate"><span class="pre">setTimeout()</span></code> that is used in web browsers or NodeJS. The <code class="docutils literal notranslate"><span class="pre">func</span></code> argument is a JavaScript function (NOT the name of a function) which will be executed after a delay. This is useful for creating animations or refreshing the overlay at constant intervals.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>func</strong> (<em>function</em>) – a JavaScript function that will be executed later</li>
<li><strong>delayMs</strong> (<em>number</em>) – the number of milliseconds to wait before executing <code class="docutils literal notranslate"><span class="pre">func</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.log">
<code class="descclassname">utility.</code><code class="descname">log</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.log" title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <code class="docutils literal notranslate"><span class="pre">[INFO]</span></code>. This is useful for debugging custom scripts.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>message</strong> (<em>string</em>) – the message to log</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.warn">
<code class="descclassname">utility.</code><code class="descname">warn</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <code class="docutils literal notranslate"><span class="pre">[WARN]</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>message</strong> (<em>string</em>) – the message to log</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.error">
<code class="descclassname">utility.</code><code class="descname">error</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Logs a message to the Porymap log file with the prefix <code class="docutils literal notranslate"><span class="pre">[ERROR]</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>message</strong> (<em>string</em>) – the message to log</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.showMessage">
<code class="descclassname">utility.</code><code class="descname">showMessage</code><span class="sig-paren">(</span><em>text</em>, <em>informativeText</em>, <em>detailedText</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.showMessage" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a message box with an “Information” icon and an <code class="docutils literal notranslate"><span class="pre">OK</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>text</strong> (<em>string</em>) – the main message text</li>
<li><strong>informativeText</strong> (<em>string</em>) – smaller text below the main message. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
<li><strong>detailedText</strong> (<em>string</em>) – text hidden behind a “Show Details” box. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.showWarning">
<code class="descclassname">utility.</code><code class="descname">showWarning</code><span class="sig-paren">(</span><em>text</em>, <em>informativeText</em>, <em>detailedText</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.showWarning" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a message box with a “Warning” icon and an <code class="docutils literal notranslate"><span class="pre">OK</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>text</strong> (<em>string</em>) – the main message text</li>
<li><strong>informativeText</strong> (<em>string</em>) – smaller text below the main message. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
<li><strong>detailedText</strong> (<em>string</em>) – text hidden behind a “Show Details” box. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.showError">
<code class="descclassname">utility.</code><code class="descname">showError</code><span class="sig-paren">(</span><em>text</em>, <em>informativeText</em>, <em>detailedText</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.showError" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a message box with a “Critical” icon and an <code class="docutils literal notranslate"><span class="pre">OK</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>text</strong> (<em>string</em>) – the main message text</li>
<li><strong>informativeText</strong> (<em>string</em>) – smaller text below the main message. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
<li><strong>detailedText</strong> (<em>string</em>) – text hidden behind a “Show Details” box. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.showQuestion">
<code class="descclassname">utility.</code><code class="descname">showQuestion</code><span class="sig-paren">(</span><em>text</em>, <em>informativeText</em>, <em>detailedText</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.showQuestion" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a message box with a “Question” icon and a <code class="docutils literal notranslate"><span class="pre">Yes</span></code> and a <code class="docutils literal notranslate"><span class="pre">No</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>text</strong> (<em>string</em>) – the main message text</li>
<li><strong>informativeText</strong> (<em>string</em>) – smaller text below the main message. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
<li><strong>detailedText</strong> (<em>string</em>) – text hidden behind a “Show Details” box. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><code class="docutils literal notranslate"><span class="pre">true</span></code> if <code class="docutils literal notranslate"><span class="pre">Yes</span></code> was selected, <code class="docutils literal notranslate"><span class="pre">false</span></code> if <code class="docutils literal notranslate"><span class="pre">No</span></code> was selected or if the window was closed without selection</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">boolean</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getInputText">
<code class="descclassname">utility.</code><code class="descname">getInputText</code><span class="sig-paren">(</span><em>title</em>, <em>label</em>, <em>default</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.getInputText" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a text input dialog with an <code class="docutils literal notranslate"><span class="pre">OK</span></code> and a <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>title</strong> (<em>string</em>) – the text in the window title bar</li>
<li><strong>label</strong> (<em>string</em>) – the text adjacent to the input entry area</li>
<li><strong>default</strong> (<em>string</em>) – the text in the input entry area when the window is opened. Defaults to <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><code class="docutils literal notranslate"><span class="pre">input</span></code> will be the input text and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">true</span></code> if <code class="docutils literal notranslate"><span class="pre">OK</span></code> was selected. <code class="docutils literal notranslate"><span class="pre">input</span></code> will be <code class="docutils literal notranslate"><span class="pre">&quot;&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">false</span></code> if <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> was selected or if the window was closed without selection.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{input,</span> <span class="pre">ok}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getInputNumber">
<code class="descclassname">utility.</code><code class="descname">getInputNumber</code><span class="sig-paren">(</span><em>title</em>, <em>label</em>, <em>default</em>, <em>min</em>, <em>max</em>, <em>decimals</em>, <em>step</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.getInputNumber" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a number input dialog with an <code class="docutils literal notranslate"><span class="pre">OK</span></code> and a <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>title</strong> (<em>string</em>) – the text in the window title bar</li>
<li><strong>label</strong> (<em>string</em>) – the text adjacent to the input entry area</li>
<li><strong>default</strong> (<em>number</em>) – the number in the input entry area when the window is opened. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>min</strong> (<em>number</em>) – the minimum allowable input value. Defaults to <code class="docutils literal notranslate"><span class="pre">-2147483648</span></code></li>
<li><strong>max</strong> (<em>number</em>) – the maximum allowable input value. Defaults to <code class="docutils literal notranslate"><span class="pre">2147483647</span></code></li>
<li><strong>decimals</strong> (<em>number</em>) – the number of decimals used for the input number. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>step</strong> (<em>number</em>) – the increment by which the input number will change when the spinner is used. Defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><code class="docutils literal notranslate"><span class="pre">input</span></code> will be the input number and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">true</span></code> if <code class="docutils literal notranslate"><span class="pre">OK</span></code> was selected. <code class="docutils literal notranslate"><span class="pre">input</span></code> will be <code class="docutils literal notranslate"><span class="pre">default</span></code> and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">false</span></code> if <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> was selected or if the window was closed without selection.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{input,</span> <span class="pre">ok}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getInputItem">
<code class="descclassname">utility.</code><code class="descname">getInputItem</code><span class="sig-paren">(</span><em>title</em>, <em>label</em>, <em>items</em>, <em>default</em>, <em>editable</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.getInputItem" title="Permalink to this definition">¶</a></dt>
<dd><p>Displays a text input dialog with an items dropdown and an <code class="docutils literal notranslate"><span class="pre">OK</span></code> and a <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> button. Execution stops while the window is open.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>title</strong> (<em>string</em>) – the text in the window title bar</li>
<li><strong>label</strong> (<em>string</em>) – the text adjacent to the input entry area</li>
<li><strong>items</strong> (<em>array</em>) – an array of text items that will populate the dropdown</li>
<li><strong>default</strong> (<em>number</em>) – the index of the item to select by default. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code></li>
<li><strong>editable</strong> (<em>boolean</em>) – whether the user is allowed to enter their own text instead. Defaults to <code class="docutils literal notranslate"><span class="pre">false</span></code></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><code class="docutils literal notranslate"><span class="pre">input</span></code> will be the input text and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">true</span></code> if <code class="docutils literal notranslate"><span class="pre">OK</span></code> was selected. <code class="docutils literal notranslate"><span class="pre">input</span></code> will be the text of the item at <code class="docutils literal notranslate"><span class="pre">default</span></code> and <code class="docutils literal notranslate"><span class="pre">ok</span></code> will be <code class="docutils literal notranslate"><span class="pre">false</span></code> if <code class="docutils literal notranslate"><span class="pre">Cancel</span></code> was selected or if the window was closed without selection.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">object (<code class="docutils literal notranslate"><span class="pre">{input,</span> <span class="pre">ok}</span></code>)</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMapNames">
<code class="descclassname">utility.</code><code class="descname">getMapNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMapNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of map names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of map names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getTilesetNames">
<code class="descclassname">utility.</code><code class="descname">getTilesetNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getTilesetNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of tileset names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of tileset names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getPrimaryTilesetNames">
<code class="descclassname">utility.</code><code class="descname">getPrimaryTilesetNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getPrimaryTilesetNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of primary tileset names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of primary tileset names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getSecondaryTilesetNames">
<code class="descclassname">utility.</code><code class="descname">getSecondaryTilesetNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getSecondaryTilesetNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of secondary tileset names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of secondary tileset names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMetatileBehaviorNames">
<code class="descclassname">utility.</code><code class="descname">getMetatileBehaviorNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMetatileBehaviorNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of metatile behavior names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of metatile behavior names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getSongNames">
<code class="descclassname">utility.</code><code class="descname">getSongNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getSongNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of song names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of song names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getLocationNames">
<code class="descclassname">utility.</code><code class="descname">getLocationNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getLocationNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of map location names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of map location names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getWeatherNames">
<code class="descclassname">utility.</code><code class="descname">getWeatherNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getWeatherNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of weather names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of weather names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getMapTypeNames">
<code class="descclassname">utility.</code><code class="descname">getMapTypeNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getMapTypeNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of map type names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of map type names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.getBattleSceneNames">
<code class="descclassname">utility.</code><code class="descname">getBattleSceneNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#utility.getBattleSceneNames" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the list of battle scene names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the list of battle scene names</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">array</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.isPrimaryTileset">
<code class="descclassname">utility.</code><code class="descname">isPrimaryTileset</code><span class="sig-paren">(</span><em>tilesetName</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.isPrimaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified tileset is a primary tileset.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>tilesetName</strong> (<em>string</em>) – the tileset name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">is a primary tileset</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">boolean</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="utility.isSecondaryTileset">
<code class="descclassname">utility.</code><code class="descname">isSecondaryTileset</code><span class="sig-paren">(</span><em>tilesetName</em><span class="sig-paren">)</span><a class="headerlink" href="#utility.isSecondaryTileset" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets whether the specified tileset is a secondary tileset.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>tilesetName</strong> (<em>string</em>) – the tileset name</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">is a secondary tileset</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">boolean</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>
<div class="section" id="constants">
<h3>Constants<a class="headerlink" href="#constants" title="Permalink to this headline">¶</a></h3>
<p>Some constant values are provided for convenience. These are read-only properties guaranteed not to change unless a new project is opened or the current one is reloaded.</p>
<p>All constants are accessible via the global <code class="docutils literal notranslate"><span class="pre">constants</span></code> object.</p>
<dl class="attribute">
<dt id="constants.max_primary_tiles">
<code class="descclassname">constants.</code><code class="descname">max_primary_tiles</code><a class="headerlink" href="#constants.max_primary_tiles" title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum number of tiles in a primary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.max_secondary_tiles">
<code class="descclassname">constants.</code><code class="descname">max_secondary_tiles</code><a class="headerlink" href="#constants.max_secondary_tiles" title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum number of tiles in a secondary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.max_primary_metatiles">
<code class="descclassname">constants.</code><code class="descname">max_primary_metatiles</code><a class="headerlink" href="#constants.max_primary_metatiles" title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum number of metatiles in a primary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.max_secondary_metatiles">
<code class="descclassname">constants.</code><code class="descname">max_secondary_metatiles</code><a class="headerlink" href="#constants.max_secondary_metatiles" title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum number of metatiles in a secondary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.num_primary_palettes">
<code class="descclassname">constants.</code><code class="descname">num_primary_palettes</code><a class="headerlink" href="#constants.num_primary_palettes" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of palettes in a primary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.num_secondary_palettes">
<code class="descclassname">constants.</code><code class="descname">num_secondary_palettes</code><a class="headerlink" href="#constants.num_secondary_palettes" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of palettes in a secondary tileset.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.layers_per_metatile">
<code class="descclassname">constants.</code><code class="descname">layers_per_metatile</code><a class="headerlink" href="#constants.layers_per_metatile" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of tile layers used in each metatile. This will either be <code class="docutils literal notranslate"><span class="pre">2</span></code> or <code class="docutils literal notranslate"><span class="pre">3</span></code>, depending on the config setting <code class="docutils literal notranslate"><span class="pre">enable_triple_layer_metatiles</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.tiles_per_metatile">
<code class="descclassname">constants.</code><code class="descname">tiles_per_metatile</code><a class="headerlink" href="#constants.tiles_per_metatile" title="Permalink to this definition">¶</a></dt>
<dd><p>The number of tiles in each metatile. This will either be <code class="docutils literal notranslate"><span class="pre">8</span></code> or <code class="docutils literal notranslate"><span class="pre">12</span></code>, depending on the config setting <code class="docutils literal notranslate"><span class="pre">enable_triple_layer_metatiles</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.metatile_behaviors">
<code class="descclassname">constants.</code><code class="descname">metatile_behaviors</code><a class="headerlink" href="#constants.metatile_behaviors" title="Permalink to this definition">¶</a></dt>
<dd><p>An object mapping metatile behavior names to their values. For example, <code class="docutils literal notranslate"><span class="pre">constants.metatile_behaviors[&quot;MB_TALL_GRASS&quot;]</span></code> would normally be <code class="docutils literal notranslate"><span class="pre">2</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.base_game_version">
<code class="descclassname">constants.</code><code class="descname">base_game_version</code><a class="headerlink" href="#constants.base_game_version" title="Permalink to this definition">¶</a></dt>
<dd><p>The string value of the config setting <code class="docutils literal notranslate"><span class="pre">base_game_version</span></code>. This will either be <code class="docutils literal notranslate"><span class="pre">pokeruby</span></code>, <code class="docutils literal notranslate"><span class="pre">pokefirered</span></code>, or <code class="docutils literal notranslate"><span class="pre">pokeemerald</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.version.major">
<code class="descclassname">constants.version.</code><code class="descname">major</code><a class="headerlink" href="#constants.version.major" title="Permalink to this definition">¶</a></dt>
<dd><p>Porymap’s major version number. For example, for Porymap version <code class="docutils literal notranslate"><span class="pre">5.1.0</span></code> this will be <code class="docutils literal notranslate"><span class="pre">5</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.version.minor">
<code class="descclassname">constants.version.</code><code class="descname">minor</code><a class="headerlink" href="#constants.version.minor" title="Permalink to this definition">¶</a></dt>
<dd><p>Porymap’s minor version number. For example, for Porymap version <code class="docutils literal notranslate"><span class="pre">5.1.0</span></code> this will be <code class="docutils literal notranslate"><span class="pre">1</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="constants.version.patch">
<code class="descclassname">constants.version.</code><code class="descname">patch</code><a class="headerlink" href="#constants.version.patch" title="Permalink to this definition">¶</a></dt>
<dd><p>Porymap’s patch version number. For example, for Porymap version <code class="docutils literal notranslate"><span class="pre">5.1.0</span></code> this will be <code class="docutils literal notranslate"><span class="pre">0</span></code>.</p>
</dd></dl>

</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="project-files.html" class="btn btn-neutral float-right" title="Project Files" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="tileset-editor.html" class="btn btn-neutral float-left" title="The Tileset Editor" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2023, huderlem

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>